home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / lotter / nlottery.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-05  |  10.8 KB  |  344 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   1  'Fixed Single
  5.    ClientHeight    =   4995
  6.    ClientLeft      =   1590
  7.    ClientTop       =   2235
  8.    ClientWidth     =   6210
  9.    ClipControls    =   0   'False
  10.    FillColor       =   &H00FFFFFF&
  11.    FillStyle       =   0  'Solid
  12.    FontBold        =   -1  'True
  13.    FontItalic      =   0   'False
  14.    FontName        =   "MS Sans Serif"
  15.    FontSize        =   12
  16.    FontStrikethru  =   0   'False
  17.    FontUnderline   =   0   'False
  18.    Height          =   5685
  19.    Icon            =   NLOTTERY.FRX:0000
  20.    Left            =   1530
  21.    LinkTopic       =   "Form1"
  22.    MaxButton       =   0   'False
  23.    ScaleHeight     =   4995
  24.    ScaleWidth      =   6210
  25.    Top             =   1605
  26.    Width           =   6330
  27.    Begin Timer Timer2 
  28.       Enabled         =   0   'False
  29.       Interval        =   2000
  30.       Left            =   120
  31.       Top             =   4320
  32.    End
  33.    Begin Timer Timer1 
  34.       Left            =   120
  35.       Top             =   3960
  36.    End
  37.    Begin CommandButton Command1 
  38.       Caption         =   "&Go !"
  39.       Default         =   -1  'True
  40.       Height          =   492
  41.       Left            =   2400
  42.       TabIndex        =   2
  43.       Top             =   3720
  44.       Width           =   1092
  45.    End
  46.    Begin Label Label2 
  47.       Alignment       =   2  'Center
  48.       BackStyle       =   0  'Transparent
  49.       FontBold        =   -1  'True
  50.       FontItalic      =   0   'False
  51.       FontName        =   "MS Sans Serif"
  52.       FontSize        =   12
  53.       FontStrikethru  =   0   'False
  54.       FontUnderline   =   0   'False
  55.       Height          =   375
  56.       Index           =   5
  57.       Left            =   5040
  58.       MousePointer    =   3  'I-Beam
  59.       TabIndex        =   3
  60.       Top             =   1500
  61.       Width           =   435
  62.    End
  63.    Begin Label Label2 
  64.       Alignment       =   2  'Center
  65.       BackStyle       =   0  'Transparent
  66.       FontBold        =   -1  'True
  67.       FontItalic      =   0   'False
  68.       FontName        =   "MS Sans Serif"
  69.       FontSize        =   12
  70.       FontStrikethru  =   0   'False
  71.       FontUnderline   =   0   'False
  72.       Height          =   375
  73.       Index           =   4
  74.       Left            =   4200
  75.       MousePointer    =   3  'I-Beam
  76.       TabIndex        =   8
  77.       Top             =   1500
  78.       Width           =   435
  79.    End
  80.    Begin Label Label2 
  81.       Alignment       =   2  'Center
  82.       BackStyle       =   0  'Transparent
  83.       FontBold        =   -1  'True
  84.       FontItalic      =   0   'False
  85.       FontName        =   "MS Sans Serif"
  86.       FontSize        =   12
  87.       FontStrikethru  =   0   'False
  88.       FontUnderline   =   0   'False
  89.       Height          =   375
  90.       Index           =   3
  91.       Left            =   3360
  92.       MousePointer    =   3  'I-Beam
  93.       TabIndex        =   7
  94.       Top             =   1500
  95.       Width           =   435
  96.    End
  97.    Begin Label Label2 
  98.       Alignment       =   2  'Center
  99.       BackStyle       =   0  'Transparent
  100.       FontBold        =   -1  'True
  101.       FontItalic      =   0   'False
  102.       FontName        =   "MS Sans Serif"
  103.       FontSize        =   12
  104.       FontStrikethru  =   0   'False
  105.       FontUnderline   =   0   'False
  106.       Height          =   375
  107.       Index           =   2
  108.       Left            =   2520
  109.       MousePointer    =   3  'I-Beam
  110.       TabIndex        =   6
  111.       Top             =   1500
  112.       Width           =   435
  113.    End
  114.    Begin Label Label2 
  115.       Alignment       =   2  'Center
  116.       BackStyle       =   0  'Transparent
  117.       FontBold        =   -1  'True
  118.       FontItalic      =   0   'False
  119.       FontName        =   "MS Sans Serif"
  120.       FontSize        =   12
  121.       FontStrikethru  =   0   'False
  122.       FontUnderline   =   0   'False
  123.       Height          =   375
  124.       Index           =   1
  125.       Left            =   1680
  126.       MousePointer    =   3  'I-Beam
  127.       TabIndex        =   5
  128.       Top             =   1500
  129.       Width           =   435
  130.    End
  131.    Begin Label Label3 
  132.       Alignment       =   2  'Center
  133.       Caption         =   "GOOD LUCK !"
  134.       FontBold        =   0   'False
  135.       FontItalic      =   -1  'True
  136.       FontName        =   "Brush Script MT"
  137.       FontSize        =   24
  138.       FontStrikethru  =   0   'False
  139.       FontUnderline   =   0   'False
  140.       ForeColor       =   &H000000FF&
  141.       Height          =   732
  142.       Left            =   1080
  143.       TabIndex        =   4
  144.       Top             =   2400
  145.       Width           =   3852
  146.    End
  147.    Begin Label Label2 
  148.       Alignment       =   2  'Center
  149.       BackStyle       =   0  'Transparent
  150.       FontBold        =   -1  'True
  151.       FontItalic      =   0   'False
  152.       FontName        =   "MS Sans Serif"
  153.       FontSize        =   12
  154.       FontStrikethru  =   0   'False
  155.       FontUnderline   =   0   'False
  156.       Height          =   375
  157.       Index           =   0
  158.       Left            =   840
  159.       MousePointer    =   3  'I-Beam
  160.       TabIndex        =   1
  161.       Top             =   1500
  162.       Width           =   435
  163.    End
  164.    Begin Label Label1 
  165.       Alignment       =   2  'Center
  166.       Caption         =   "Your numbers for this week are :"
  167.       FontBold        =   -1  'True
  168.       FontItalic      =   0   'False
  169.       FontName        =   "Times New Roman"
  170.       FontSize        =   18
  171.       FontStrikethru  =   0   'False
  172.       FontUnderline   =   0   'False
  173.       Height          =   492
  174.       Left            =   480
  175.       TabIndex        =   0
  176.       Top             =   360
  177.       Width           =   5292
  178.    End
  179.    Begin Shape Shape1 
  180.       BackColor       =   &H00C0C0C0&
  181.       BackStyle       =   1  'Opaque
  182.       BorderColor     =   &H00404040&
  183.       Height          =   735
  184.       Index           =   0
  185.       Left            =   720
  186.       Shape           =   3  'Circle
  187.       Top             =   1320
  188.       Width           =   675
  189.    End
  190.    Begin Shape Shape1 
  191.       BackColor       =   &H00C0C0C0&
  192.       BackStyle       =   1  'Opaque
  193.       BorderColor     =   &H00404040&
  194.       Height          =   735
  195.       Index           =   5
  196.       Left            =   4920
  197.       Shape           =   3  'Circle
  198.       Top             =   1320
  199.       Width           =   675
  200.    End
  201.    Begin Shape Shape1 
  202.       BackColor       =   &H00C0C0C0&
  203.       BackStyle       =   1  'Opaque
  204.       BorderColor     =   &H00404040&
  205.       Height          =   735
  206.       Index           =   4
  207.       Left            =   4080
  208.       Shape           =   3  'Circle
  209.       Top             =   1320
  210.       Width           =   675
  211.    End
  212.    Begin Shape Shape1 
  213.       BackColor       =   &H00C0C0C0&
  214.       BackStyle       =   1  'Opaque
  215.       BorderColor     =   &H00404040&
  216.       Height          =   735
  217.       Index           =   3
  218.       Left            =   3240
  219.       Shape           =   3  'Circle
  220.       Top             =   1320
  221.       Width           =   675
  222.    End
  223.    Begin Shape Shape1 
  224.       BackColor       =   &H00C0C0C0&
  225.       BackStyle       =   1  'Opaque
  226.       BorderColor     =   &H00404040&
  227.       Height          =   735
  228.       Index           =   2
  229.       Left            =   2400
  230.       Shape           =   3  'Circle
  231.       Top             =   1320
  232.       Width           =   675
  233.    End
  234.    Begin Shape Shape1 
  235.       BackColor       =   &H00C0C0C0&
  236.       BackStyle       =   1  'Opaque
  237.       BorderColor     =   &H00404040&
  238.       Height          =   735
  239.       Index           =   1
  240.       Left            =   1560
  241.       Shape           =   3  'Circle
  242.       Top             =   1320
  243.       Width           =   675
  244.    End
  245.    Begin Menu Opts 
  246.       Caption         =   "&Options"
  247.       Begin Menu abt 
  248.          Caption         =   "&About"
  249.       End
  250.       Begin Menu Endit 
  251.          Caption         =   "&Exit"
  252.          Shortcut        =   ^X
  253.       End
  254.    End
  255. Dim NumBalls%
  256. Dim Winners%(1 To 6)
  257. Sub abt_Click ()
  258. form1.Hide
  259. form2.Show
  260. End Sub
  261. Sub Command1_Click ()
  262. rando   'call generator
  263. End Sub
  264. Sub Endit_Click ()
  265. End Sub
  266. Sub ex_Click ()
  267. End Sub
  268. Sub exit_Click ()
  269. MsgBox "!"
  270. End Sub
  271. Sub Form_Load ()
  272. label3.Visible = True   'set the environment
  273. Timer1.Interval = 300
  274. timer2.Interval = 500
  275. startwindowscroll 'start the scrolling title screen
  276.                   'The windowscroll routine is located in a seperate
  277.                   ' .BAS file (Don't ask me why other than it has to have a global
  278.                   'declaration !
  279. End Sub
  280. Sub Ian_Click ()
  281. form2.Show 1
  282. End Sub
  283. Sub menu1_Click ()
  284. End Sub
  285. Sub rando ()
  286. Dim inum%, n%, Temp%
  287. Randomize ' set seed
  288.    ReDim Balls%(1 To 49)
  289.    Dim LoopCheck%, NoSwap%
  290.    timer2.Enabled = False            ' ball display timer
  291.    For n = 0 To 5
  292.       form1.Label2(n).Caption = ""   'clear the display
  293.       form1.Shape1(n).BackColor = &HC0C0C0   ' grey
  294.    Next n
  295.    For n = 1 To 49: Balls%(n) = n: Next n
  296.    For n = 1 To 6
  297.       LoopCheck = 0
  298.       Do
  299.          inum = Int(49 * Rnd + 1) ' generate the numbers
  300.       Loop Until (Balls%(inum) > 0) Or (LoopCheck > 99)
  301.       If LoopCheck > 99 Then
  302.          MsgBox "Error generating numbers"
  303.          Exit Sub
  304.       End If
  305.       Balls%(inum) = 0
  306.       Winners%(n) = inum
  307.    Next n                         ' got 6 random numbers
  308.    Do                             ' bubble sort array
  309.       NoSwap = True
  310.       For n = 1 To 5
  311.          If Winners%(n + 1) < Winners%(n) Then
  312.             Temp = Winners%(n + 1)
  313.             Winners%(n + 1) = Winners%(n)
  314.             Winners%(n) = Temp
  315.             NoSwap = False
  316.          End If
  317.       Next n
  318.    Loop Until NoSwap%
  319.    timer2.Enabled = True          ' this starts the display
  320.    NumBalls = 1                   ' timer to show the balls
  321.                                   ' one by one. See Timer2_Click
  322.                                   ' routine.
  323. End Sub
  324.  Sub Timer1_Timer ()
  325.       irndcolor = Int(Rnd * 14 + 1)           'random colours on the Thank You
  326.       label3.ForeColor = QBColor(irndcolor)
  327.    WinTitle = Mid(WinTitle, 2) & Left(WinTitle, 1)   'scroll the titles
  328.     form1.Caption = WinTitle
  329.                                                              
  330. End Sub
  331. Sub Timer2_Timer ()
  332.    Dim BNum%, BCol&
  333.    If NumBalls > 6 Then Exit Sub
  334.    BNum = Winners%(NumBalls)  ' the ball number
  335.    If BNum < 10 Then BCol = &HFFFFFF                   'white
  336.    If BNum >= 10 And BNum < 20 Then BCol = &HFF8080       'blue
  337.    If BNum >= 20 And BNum < 30 Then BCol = &H8080FF    'Pink
  338.    If BNum >= 30 And BNum < 40 Then BCol = &HFF00&     'Green
  339.    If BNum >= 40 Then BCol = &HFFFF&                   'Yellow
  340.    form1.Shape1(NumBalls - 1).BackColor = BCol
  341.    form1.Label2(NumBalls - 1).Caption = BNum
  342.    NumBalls = NumBalls + 1
  343. End Sub
  344.